var Ball=function (x,y,radius) {
    this.x=x;
    this.y=y;
    this.speedX=15;
    this.speedY=0;
    this.radius=radius;
    this.oDiv=$('<div class="ball"></div>');
    document.getElementById('cqr').appendChild(this.oDiv.get(0));
    this.interval=null;
};
Ball.prototype.refreshPosition=function(){
    this.oDiv.css({
        'top':this.y+'px',
        'left':this.x+'px'
    })
}
Ball.prototype.toGravity=function () {
    console.log(this.speedY);
    this.speedY=this.speedY+g*t;
    this.y+=this.speedY*t/2;
    if(this.y>600){
        if(this.speedY<0&&this.speedY>-1){
            this.speedY=0;
        }
        if(this.speedX>0){
            this.speedX--;
        }
        if(this.speedY>=10){
            this.speedY=-(this.speedY-10);
        }else {
            this.speedY-=1;
        }
    }
    this.refreshPosition();
}
Ball.prototype.moveX=function () {
    this.x+=this.speedX*t;
    if(this.x>800||this.x<50){
        this.speedX=-this.speedX;
    }
}